package online.shenme.day02;

import java.util.Scanner;

//自增自减运算符
public class Calculate {
    public static void main(String[] args) {
        int num, ge, shi, bai, x, y, z;
        System.out.println("    自增自减练习");
        System.out.println("请输入数值：");
        Scanner input = new Scanner(System.in);
        num = 10;
        ge = num % 10;
        shi = num / 10 % 10;
        bai = num / 100 % 10;
        System.out.println("数值" + num + "的个位是：" + ge);
        System.out.println("数值" + num + "的十位是：" + shi);
        System.out.println("数值" + num + "的百位是：" + bai);

        System.out.println("结果是" + (double) 5);
        x = num++;
        System.out.println("x1=" + x);
        System.out.println("num=" + num);
        y = num++ + x++ + ++x;
//        x2=12,y1=33,
        System.out.println("x2=" + x + "    y1=" + y + "num=" + num);
    }
}
//三元运算符的使用
class Convert {
    //      三个值当中求最大值、最小值、排序
    public static void main(String[] args) {
        int a, b, c, max, mid, min;
        Scanner input = new Scanner(System.in);
        System.out.println("请任意输入三个整数：");
        a = input.nextInt();
        b = input.nextInt();
        c = input.nextInt();
        if (a >= b && b >= c) {
            min = c;
            mid = b;
            max = a;
        } else if (a >= c && c >= b) {
            min = b;
            mid = c;
            max = a;
        } else if (b >= a && a >= c) {
            min = c;
            mid = a;
            max = b;
        } else if (b >= c) {
            min = a;
            mid = c;
            max = b;
        } else if (b >= a) {
            min = a;
            mid = b;
            max = c;
        } else {
            min = c;
            mid = a;
            max = b;
        }
        System.out.println("从小到大：" + min + " " + mid + " " + max);
    }
}